ThinkPHP5


think\console\input\Argument
library\think\console\input\Argument.php at line 14

Class Argument

Argument

public class Argument


Constant Summary
final static int

IS_ARRAY

final static int

OPTIONAL

final static int

REQUIRED

Constructor Summary
void

__construct(string name, int mode, string description, mixed default)

构造方法

Method Summary
string

getName()

获取参数名

bool

isRequired()

是否必须

bool

isArray()

该参数是否接受数组

void

setDefault(mixed default)

设置默认值

mixed

getDefault()

获取默认值

string

getDescription()

获取描述

Constant Detail

library\think\console\input\Argument.php at line 19

IS_ARRAY

public final static int IS_ARRAY = 4

library\think\console\input\Argument.php at line 18

OPTIONAL

public final static int OPTIONAL = 2

library\think\console\input\Argument.php at line 17

REQUIRED

public final static int REQUIRED = 1

Constructor Detail

library\think\console\input\Argument.php at line 34

__construct

public void __construct(string name, int mode, string description, mixed default)

构造方法

Parameters:
name - 参数名
mode - 参数类型: self::REQUIRED 或者 self::OPTIONAL
description - 描述
default - 默认值 (仅 self::OPTIONAL 类型有效)
Throws:
\InvalidArgumentException

Method Detail

library\think\console\input\Argument.php at line 53

getName

public string getName()

获取参数名


library\think\console\input\Argument.php at line 62

isRequired

public bool isRequired()

是否必须


library\think\console\input\Argument.php at line 71

isArray

public bool isArray()

该参数是否接受数组


library\think\console\input\Argument.php at line 81

setDefault

public void setDefault(mixed default)

设置默认值

Parameters:
default - 默认值
Throws:
\LogicException

library\think\console\input\Argument.php at line 102

getDefault

public mixed getDefault()

获取默认值


library\think\console\input\Argument.php at line 111

getDescription

public string getDescription()

获取描述


ThinkPHP5